#include <iostream>

using namespace std;

typedef long long LL;

const int N = 1e6 + 10;
int a[N], c[N];
int la, lc, b;

LL div(int c[], int a[], int b)
{
	LL t = 0;
	for(int i = lc - 1; i >= 0; i--)
	{
		t = t * 10 + a[i];
		c[i] = t / b;
		t %= b;
	}
	while(lc > 1 && c[lc - 1] == 0) lc--;
	return t;
}

int main()
{
	string s; cin >> s >> b;
	lc = la = s.size();
	
	for(int i = 0; i < la; i++) a[la - 1 - i] = s[i] - '0';
	
	LL r = div(c, a, b);
	
	for(int i = lc - 1; i >= 0; i--) cout << c[i];
	return 0;
}
